package app.r_teenus.backend.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "SERVICE_REQUEST")
public class ServiceRequest implements Serializable {

	private static final long serialVersionUID = -1027665755783555722L;
	private Integer id = null;
	private Customer customer = null;
	private Integer createdBy = null;
	private Date created = null;
	private String descriptionByCustomer = null;
	private String descriptionByEmployee = null;
	private ServiceRequestStatusType serviceRequestStatusType = null;
	private List<ServiceRequest> list = new ArrayList<ServiceRequest>();
	private String searchText = null;
	private boolean canRemove = false;
	private boolean existOrder  = false;
	/**
	 * Gets id (primary key).
	 */
	@Id
	@Column(name = "SERVICE_REQUEST")
	@SequenceGenerator(name = "service_request_id", sequenceName = "service_request_id", allocationSize = 1)
	@GeneratedValue(generator = "service_request_id")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@OneToOne
	@JoinColumn(name = "CUSTOMER_FK", nullable = false)
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "CREATED_BY")
	public Integer getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Column(name = "SERVICE_DESC_BY_CUSTOMER")
	public String getDescriptionByCustomer() {
		return descriptionByCustomer;
	}

	public void setDescriptionByCustomer(String descriptionByCustomer) {
		this.descriptionByCustomer = descriptionByCustomer;
	}

	@Column(name = "SERVICE_DESC_BY_EMPLOYEE")
	public String getDescriptionByEmployee() {
		return descriptionByEmployee;
	}

	public void setDescriptionByEmployee(String descriptionByEmployee) {
		this.descriptionByEmployee = descriptionByEmployee;
	}

	@OneToOne
	@JoinColumn(name = "SERVICE_REQUEST_STATUS_TYPE_FK", nullable = false)
	public ServiceRequestStatusType getServiceRequestStatusType() {
		return serviceRequestStatusType;
	}

	public void setServiceRequestStatusType(ServiceRequestStatusType serviceRequestStatusType) {
		this.serviceRequestStatusType = serviceRequestStatusType;
	}

	@Transient
	public List<ServiceRequest> getList() {
		return list;
	}

	public void setList(List<ServiceRequest> list) {
		this.list = list;
	}

	@Transient
	public String getSearchText() {
		return searchText;
	}

	public void setSearchText(String searchText) {
		this.searchText = searchText;
	}

	@Transient
	public boolean isCanRemove() {
		return canRemove;
	}

	public void setCanRemove(boolean canRemove) {
		this.canRemove = canRemove;
	}

	@Transient
	public boolean isExistOrder() {
		return existOrder;
	}

	public void setExistOrder(boolean existOrder) {
		this.existOrder = existOrder;
	}

	
}
